import { Model, DataTypes } from 'sequelize';
import { sequelize } from './db';

class Streamer extends Model {
  public id!: string;
  public name!: string;
  public status?: string;
  public priority!: number;
  public liveId?: string;
}

Streamer.init(
  {
    id: {
      type: DataTypes.STRING,
      primaryKey: true,
    },
    name: {
      type: DataTypes.STRING,
      allowNull: false,
    },
 
  
    status: {
      type: DataTypes.STRING,
      allowNull: true,
      defaultValue: '离线',
    },
    priority: {
      type: DataTypes.INTEGER,
      allowNull: true,
      defaultValue: 0
    },
    liveId: {
      type: DataTypes.STRING,
      allowNull: true
    }
  },
  {
    sequelize,
    modelName: 'Streamer',
    timestamps: true,
    freezeTableName: true
  }
);

export default Streamer;